<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/struts-bean" prefix="bean"%> 
<%@ taglib uri="/WEB-INF/tld/struts-html" prefix="html"%>
<%@ taglib uri="/WEB-INF/tld/struts-logic" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tld/jstl/c" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/jstl/fn" prefix="fn" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
  <head>
    <html:base />
    
    <title>类别管理</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script language="JavaScript">
<!--//

		
function selectAll(choice) {
   if(document.forms['theForm1'].checkboxparam.length!=null)
   {
	   for (var i=0;i<document.forms['theForm1'].checkboxparam.length;i++) 
	   {
			var e=document.forms['theForm1'].checkboxparam[i];
			if(choice==1)e.checked=true;
			if(choice==2)e.checked=(e.checked?false:true);
			if(choice==3)e.checked=false;
		}
   }
   
   //单个的处理
   else
   {
     var e=document.forms['theForm1'].checkboxparam;
     if(choice==1)e.checked=true;
			if(choice==2)e.checked=(e.checked?false:true);
			if(choice==3)e.checked=false;
     
   }
	
}

function  checkboxIsSelected(){

   var flag = 0;
   if(document.forms['theForm1'].checkboxparam.length!=null)
   {
        for (var i=0;i<document.forms['theForm1'].checkboxparam.length;i++) 
		   {
		        var e=document.forms['theForm1'].checkboxparam[i];
		        if(e.checked){
					flag = 1;
				}
		   }
		   if(flag==1)
		   {
		     return true;
		   }else{
		        window.alert('至少选择一项!');
		        return false;
		   }
   }
   
   //只选择了一项
   else if(document.forms['theForm1'].checkboxparam!=null)
   {
       var e=document.forms['theForm1'].checkboxparam;
        if(e.checked)
        {
					flag = 1;
	    }
	    
	      if(flag==1)
		   {
		      return true
           }else{
		        window.alert('至少选择一项!');
		        return false;
		   }
   }
   		        window.alert('至少选择一项!');
		        return false;
}
//-->
</script>
  </head>
  
  <body>
  <logic:present name="del">
  <bean:write name="del" filter="false"/>
  </logic:present>
  <logic:present name="update">
  <bean:write name="update" filter="false"/>
  </logic:present>
	
<div class="cpxx1">
   <h1><img src="image/qqddc_shop3.gif" width="730" height="7" /></h1>
   <p>类别管理 </p>
  <div class="cpxx2">
   <br/>
  
  
  
      <logic:present name="BmClassTypeList">
	<logic:notEmpty name="BmClassTypeList">
  
  	<form action="/admin/bmClassType.do?method=delete" name="theForm1" method="post" id="theForm1">
    <table width="95%" border="1" style="border-collapse:collapse" bordercolor="#CFCFCF">

      <tr style="text-align:center; font-weight:bold;">
        <td width="5%"></td>
        <td width="17%">名称</td>
        <td width="13%">是否删除</td>
        <td width="8%">修改</td>
      </tr>

	<logic:iterate id="list" name="BmClassTypeList">
      <tr style="text-align:center;">
      
        <td><label>
          <input type="checkbox" id="checkboxparam" name="checkboxparam" value="${list.id}" />
        </label></td>
        <td><label>
          ${list.classTypeName}
        </label></td>
        <td><label>
        <c:if test="${list.del==1}">已删除</c:if>
        <c:if test="${list.del==0}">未删除</c:if>
       </label></td>
        <td><html:link action="/admin/bmClassType.do?method=toupdate&id=${list.id }">修改</html:link></td>
      </tr>
      
      	</logic:iterate>

		<tr>
	<td colspan=9>
	<table width="100%" border="1" align="center" cellpadding="0"
			cellspacing="0">
			<tr>
				<td height="4"></td>
			</tr>
			<logic:present name="BmClassTypeList">
				<tr>
					<td>
						<html:button onclick="selectAll(1);" property="button" value="全选" />
						&nbsp;
						<html:button onclick="selectAll(2);" property="button" value="反选" />
						&nbsp;
						<html:button onclick="selectAll(3);" property="button" value="不选" />
						&nbsp;
						<input type="submit" value="批量删除" name="submit"
							onclick="return checkboxIsSelected();">
					</td>
				</tr>
			</logic:present>
		</table>
	</td>
	</tr>
	
		
	<tr>
	<td colspan=12>
	      <table align="center">
            <tr>
               <td colspan="8" align="right">
                      当前是第${curPage}页,总共${allPage}页&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;
                      <html:link action="/admin/bmClassType.do?method=list&page=${1}&pageSize=${pageSize}" >首页</html:link>
                      <html:link action="/admin/bmClassType.do?method=list&curPage=${curPage}&backPage=${backPage}&nextPage=${nextPage}&page=${page}&pageSize=${pageSize}&doit=backPage" >上一页</html:link>
                      
                      
                      <%--  页码循环 --%>
          <c:forEach begin="${1}" end="${allPage}" var="page" varStatus="pageCount">
                 <html:link action="/admin/bmClassType.do?method=list&curPage=${curPage}&backPage=${backPage}&nextPage=${nextPage}&page=${pageCount.index}&pageSize=${pageSize}" >
                    
                    <c:if test="${curPage==page}">
		                  <font color="red" class="one"><c:out value="${pageCount.index}"></c:out></font>
		            </c:if>
		            <c:if test="${curPage!=page}">
		              <c:out value="${pageCount.index}"></c:out>
		            </c:if>
		                 
		                 
                  </html:link>
          </c:forEach>              
                      
                      
                      
                      
                      
                      <html:link action="/admin/bmClassType.do?method=list&curPage=${curPage}&backPage=${backPage}&nextPage=${nextPage}&page=${page}&pageSize=${pageSize}&doit=nextPage" >下一页</html:link>
               <html:link action="/admin/bmClassType.do?method=list&page=${allPage}&pageSize=${pageSize}" >尾页</html:link>       
               </td>
                              
                              
            </tr>
           </table>
	</td>
	</tr>
    </table>
    
    </form>
    
    	</logic:notEmpty>
	</logic:present>
	      <logic:present name="BmClassTypeList">
<logic:empty name="BmClassTypeList">
<font color="red">对不起！！！，没有搜索到你想要的结果！！！</font>
</logic:empty>
	</logic:present>
    
  </div>
   <h1><img src="image/qqddc_shop1.gif" width="720" height="8" /></h1>
</div>
	

  </body>
</html:html>










